<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
  </head>

  <body>
    <!-- react容器 -->
    <div id="test"></div>

    <!-- 引入react核心库 -->
    <script src="../lib/react.js"></script>
    <!-- 引入react-dom -->
    <script src="../lib/react-dom.js"></script>
    <!-- 引入babel -->
    <script src="../lib/babel.min.js"></script>
    <script type="text/babel">
      //1 创建虚拟DOM
      class Demo extends React.Component {
        render() {
          return (
            <div>
              <input ref={this.myRef} type="text" />
              <button onClick={this.showData}>点我提示左侧数据</button>
              <input onBlur={this.showData2} type="text" />
            </div>
          );
        }
        showData = () => {
          console.log(this.myRef.current.value);
        };
        showData2 = (event)=>{
            console.log(event.target.value)
        }
        //返回一个容器，该容器可以存储被ref标识的节点
        myRef = React.createRef();
      }

      ReactDOM.render(<Demo />, document.getElementById("test"));
    </script>
  </body>
</html>
